//
//  RecordView.m
//  Run
//
//  Created by sxz on 16/4/7.
//  Copyright © 2016年 BetaTheta. All rights reserved.
//

#import "RecordView.h"

@implementation RecordView

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:0.224 green:0.224 blue:0.255 alpha:1.000];
        [self createView];
    }
    return self;
    
}

- (void)createView {
    
    // 累计训练
    self.trainTime = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width / 2 - 20, self.bounds.size.height / 2)];
    self.trainTime.center = CGPointMake(self.bounds.size.width / 4, self.bounds.size.height / 2);
    self.trainTime.text = @"--";
    self.trainTime.textColor = [UIColor whiteColor];
    self.trainTime.textAlignment = NSTextAlignmentCenter;
    self.trainTime.font = [UIFont boldSystemFontOfSize:40];
    
    self.trainTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.trainTime.frame.origin.x, self.trainTime.frame.size.height + self.trainTime.frame.origin.y, self.trainTime.frame.size.width, 20)];
    self.trainTimeLabel.textAlignment = NSTextAlignmentCenter;
    self.trainTimeLabel.textColor = [UIColor whiteColor];
    self.trainTimeLabel.text = @"累计次数";
    self.trainTimeLabel.font = [UIFont systemFontOfSize:18];
    
    [self addSubview:self.trainTime];
    [self addSubview:self.trainTimeLabel];
    
    // 累计总公里
    self.totalDistance = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.trainTime.frame.size.width, self.trainTime.frame.size.height)];
    self.totalDistance.center = CGPointMake(self.bounds.size.width / 4 * 3, self.bounds.size.height / 2);
    self.totalDistance.text = @"--";
    self.totalDistance.textColor = [UIColor whiteColor];
    self.totalDistance.textAlignment = NSTextAlignmentCenter;
    self.totalDistance.font = [UIFont boldSystemFontOfSize:40];
    
    self.totalDistanceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.totalDistance.frame.origin.x, self.totalDistance.frame.size.height + self.totalDistance.frame.origin.y, self.totalDistance.frame.size.width, self.trainTimeLabel.frame.size.height)];
    self.totalDistanceLabel.textAlignment = NSTextAlignmentCenter;
    self.totalDistanceLabel.textColor = [UIColor whiteColor];
    self.totalDistanceLabel.text = @"累计总公里";
    self.totalDistanceLabel.font = [UIFont systemFontOfSize:18];
    
    [self addSubview:self.totalDistance];
    [self addSubview:self.totalDistanceLabel];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
